<%@page language="java" contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%String titlename="新建光缆";%>
<HTML>
<HEAD>
<TITLE><%=titlename%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="Admin_Style.css" type=text/css rel=stylesheet>
</HEAD>
<BODY leftMargin="2" topMargin="0" marginheight="0" marginwidth="0" style="overflow:hidden">
<script language="javascript" src="jscheck.js">
</script>
<script>
    <!--
    function tst(obj0,obj1,obj2){
        obj0.style.border="1 "+obj1+" solid";
        obj0.style.background=obj2;
    }
    //-->
	function btnReturn(){
	     window.open("/btsm/nnlist_cable.jsp","_self");
	}
	
	function btnSubmit(){
		document.Jz_myform.submit();
	}	
</script>
<SCRIPT LANGUAGE="JavaScript">
    <!--
    function textCounter(field, maxlimit) {
        if (field.value.length > maxlimit)
            field.value = field.value.substring(0, maxlimit);
    }
    //-->
</SCRIPT>
<script language="JavaScript" type="text/javascript">
<!--
	var allBTSCodeS = [];
	var allBTSCodeE = [];	

function updateBTSCNS(){

    var properties = xmlHttp.responseXML.getElementsByTagName("property");
    var models = document.getElementById("selbtsns");
	var property = null;
	var btsName = "";
	var btsCode = "";	
	var option = null;

	allBTSCodeS.length = 0;
	
	clearModelsList("selbtsns");

    for(var i = 0; i < properties.length; i++) {
        property = properties[i];
        btsName = property.getElementsByTagName("btsName")[0].firstChild.nodeValue;
		btsCode = property.getElementsByTagName("btsCode")[0].firstChild.nodeValue;
				
		option = document.createElement("option");
		option.appendChild(document.createTextNode(btsName));
		option.value = btsName;
        models.appendChild(option);
		
		allBTSCodeS.push(btsCode);
	}
}
function updateBTSCNE(){

    var properties = xmlHttp.responseXML.getElementsByTagName("property");
    var models = document.getElementById("selbtsne");
    var property = null;
	var btsName = "";
	var btsCode = "";
	var option = null;
	
	allBTSCodeE.length = 0;	
	
	clearModelsList("selbtsne");	

    for(var i = 0; i < properties.length; i++) {
        property = properties[i];
        btsName = property.getElementsByTagName("btsName")[0].firstChild.nodeValue;
		btsCode = property.getElementsByTagName("btsCode")[0].firstChild.nodeValue;
		
		option = document.createElement("option");
		option.appendChild(document.createTextNode(btsName));
		option.value = btsName;
        models.appendChild(option);	
		
		allBTSCodeE.push(btsCode);	
    }

}
//-->

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function getBTSCNS() {

    var url = "ser_graph?"
        + createQueryString("serbtscnbq") + "&txtBTSFilter=" + document.getElementById("ocbtscs").value + "&ts=" + new Date().getTime();

    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChangeS;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function getBTSCNE() {

    var url = "ser_graph?"
        + createQueryString("serbtscnbq") + "&txtBTSFilter=" + document.getElementById("ocbtsce").value + "&ts=" + new Date().getTime();

    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChangeE;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function createQueryString(strOnlineUN) {

    var queryString = "seraction=" + strOnlineUN;
    return queryString;

}
 
function handleStateChangeS() {

    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            updateBTSCNS();
        }
    }
}
function handleStateChangeE() {

    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            updateBTSCNE();
        }
    }
}

function clearModelsList(selbtsid) {
    var models = document.getElementById(selbtsid);
    while(models.childNodes.length > 0) {
        models.removeChild(models.childNodes[0]);
    }
}

function changeselbts(selbtsn, txtbtsCode, allBtsC){
	txtbtsCode.value = allBtsC[selbtsn.selectedIndex];
}

</script>

<SCRIPT LANGUAGE="JavaScript">
    <!--
    function textCounter(field, maxlimit) {
        if (field.value.length > maxlimit)
            field.value = field.value.substring(0, maxlimit);
    }
    //-->
</SCRIPT>

<TABLE cellSpacing="0" align="center" cellPadding="0" width="100%" border=0>
  <TBODY>
    <TR>
      <TD><TABLE class=border cellSpacing=1 cellPadding=2 width="100%" align="center" border="0">
          <FORM name="Jz_myform" action="ser_cable" method="post">
            <!--添加数据表单开始cs.jsp-->
            <TBODY id=Tabs>
              <TR class=tdbg>
                <TD class=tdbg5 height="26">光缆编号：</TD>
                <TD height="26"><input type="text" name="T1" id="sjidxid" size="20" maxlength="12" onBlur="checkQuote(this.value,this)">
                </TD>
                <TD class=tdbg5 height="26">光缆名称：</TD>
                <TD height="26"><input type="text" name="T1" id="ocname" size="20" maxlength="12"></TD>
              </TR>
              <TR class=tdbg>
                <TD class=tdbg5 height="26">起点站编号：</TD>
                <TD height="26"><input type="text" name="T1" id="ocbtscs" size="20" maxlength="12" onBlur="checkQuote(this.value,this)" onKeyDown="if(event.keyCode==13){getBTSCNS()};"></TD>
                <TD class=tdbg5 height="26">起点站名称：</TD>
                <TD height="26"><select size="1" name="T1" id="selbtsns" style="width: 122; height: 23" onChange="changeselbts(this, ocbtscs, allBTSCodeS);">
                  </select></TD>
              </TR>
              <TR class=tdbg>
                <TD class=tdbg5 height="26">终点站编号：</TD>
                <TD height="26"><input type="text" name="T1" id="ocbtsce" size="20" maxlength="12" onBlur="checkQuote(this.value,this)" onKeyDown="if(event.keyCode==13){getBTSCNE()};" ></TD>
                <TD class=tdbg5 height="26">终点站名称：</TD>
                <TD height="26"><select size="1" name="T1" id="selbtsne" style="width: 122; height: 23" onChange="changeselbts(this, ocbtsce, allBTSCodeE);">
                  </select></TD>
              </TR>
              <tr class=tdbg>
                <TD class=tdbg5 height="26">敷设方式：</TD>
                <TD height="26"><select size="1" name="T1">
                    <option value="架空" selected="selected">架空</option>
                    <option value="管道">管道</option>
                    <option value="直埋" >直埋</option>
                  </select>
                </TD>
                <TD class=tdbg5 height="26">光缆厂家：</TD>
                <TD height="26"><input type="text" name="T1" size="20" maxlength="11"></TD>
              </tr>
              <tr class=tdbg>
                <TD class=tdbg5 height="18">光缆型号：</TD>
                <TD height="18"><input type="text" name="T1" size="20"></TD>
                <TD class=tdbg5 height="18">在网状况：</TD>
                <TD colspan="2" height="18"><select size="1" name="T1">
                    <option value="本地网">本地网</option>
                    <option value="一干">一干</option>
                    <option value="二干" >二干</option>
                  </select></TD>
              </tr>
              <TR class=tdbg>
                <TD class=tdbg5 height="18">中继段共计电杆号：</TD>
                <TD height="18" colspan="3"><input type="text" name="T1" size="60">
                  <input type="hidden" name="T1" value=""></TD>
              </TR>
              <TR class=tdbg>
                <TD class=tdbg5 height="18">备注：</TD>
                <TD height="18" colspan="3"><textarea rows="7" name="T1" id="T2" cols="60" class=text2d onPropertyChange="textCounter(T2,64)"></textarea></TD>
              </TR>
              <TR class=tdbg>
                <TD class=tdbg5 height="51" colspan="4"><p align="center">
                    <%
            String jspName = request.getRequestURI();
            jspName = jspName.substring(jspName.lastIndexOf("/") + 1);
                                    %>
                    <input type="hidden" name="filesnames" value=<%=jspName%>>
                    <input type="hidden" name="seraction" value="seradd">
                    <input type="button" value=" 保 存 " onClick="btnSubmit();">
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="reset" value="重置" name="JzB2" style="width: 72; height: 25" class=tx_button onMouseOver="tst(this,'blue','#ffffff')" onMouseOut="tst(this,'black','#e8e7fe')">
                </TD>
              </TR>
            </TBODY>
          </FORM>
        </TABLE></TD>
    </TR>
  </TBODY>
</TABLE>
</BODY>
</HTML>
